package com.qmrssreader.dto;

import java.text.SimpleDateFormat;
import java.util.Date;

public class RssItem implements Comparable<RssItem> {
	private String title;
	private String description;
	private Date pubDate;
	private String link;
	private String imgURL;

	public RssItem() {

	}

	public RssItem(String title, String description, Date pubDate, String link) {
		this.title = title;
		this.description = description;
		this.pubDate = pubDate;
		this.link = link;
	}

	public RssItem(String title, String description, Date pubDate, String link,
			String img) {
		this.title = title;
		this.description = description;
		this.pubDate = pubDate;
		this.link = link;
		this.imgURL = img;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getPubDate() {
		return pubDate;
	}

	public void setPubDate(Date pubDate) {
		this.pubDate = pubDate;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getImgURL() {
		return imgURL;
	}

	public void setImgURL(String imgURL) {
		this.imgURL = imgURL;
	}

	@Override
	public String toString() {

		SimpleDateFormat sdf = new SimpleDateFormat("EEE d MMM \t hh:mm aa");
		String result = this.getTitle() + "\n" + sdf.format(this.getPubDate());
		return result;
	}

	@Override
	public int compareTo(RssItem arg0) {
		// TODO Auto-generated method stub
		return arg0.getPubDate().compareTo(this.getPubDate());
	}
}
